package com.tongcao.cn.config;

import com.tongcao.cn.servlet.MyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:tongcao
 * @Date:2018/8/23 18:15
 * Description:
 */
@Configuration
public class ServlertConfigure {

    /**
     * 代码注册servlet(不需要@ServletComponentScan注解)
     * @return
     */
    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        return new ServletRegistrationBean(new MyServlet(), "/servlet/myServlet1");// ServletName默认值为首字母小写，即myServlet1
    }

}
